(function (cjs, an) {

var p; // shortcut to reference prototypes
var lib={};var ss={};var img={};
lib.ssMetadata = [
		{name:"CollideTest_atlas_1", frames: [[0,0,458,464]]}
];


(lib.AnMovieClip = function(){
	this.actionFrames = [];
	this.ignorePause = false;
	this.gotoAndPlay = function(positionOrLabel){
		cjs.MovieClip.prototype.gotoAndPlay.call(this,positionOrLabel);
	}
	this.play = function(){
		cjs.MovieClip.prototype.play.call(this);
	}
	this.gotoAndStop = function(positionOrLabel){
		cjs.MovieClip.prototype.gotoAndStop.call(this,positionOrLabel);
	}
	this.stop = function(){
		cjs.MovieClip.prototype.stop.call(this);
	}
}).prototype = p = new cjs.MovieClip();
// symbols:



(lib.CachedBmp_1 = function() {
	this.initialize(ss["CollideTest_atlas_1"]);
	this.gotoAndStop(0);
}).prototype = p = new cjs.Sprite();
// helper functions:

function mc_symbol_clone() {
	var clone = this._cloneProps(new this.constructor(this.mode, this.startPosition, this.loop, this.reversed));
	clone.gotoAndStop(this.currentFrame);
	clone.paused = this.paused;
	clone.framerate = this.framerate;
	return clone;
}

function getMCSymbolPrototype(symbol, nominalBounds, frameBounds) {
	var prototype = cjs.extend(symbol, cjs.MovieClip);
	prototype.clone = mc_symbol_clone;
	prototype.nominalBounds = nominalBounds;
	prototype.frameBounds = frameBounds;
	return prototype;
	}


(lib.ptSb = function(mode,startPosition,loop,reversed) {
if (loop == null) { loop = true; }
if (reversed == null) { reversed = false; }
	var props = new Object();
	props.mode = mode;
	props.startPosition = startPosition;
	props.labels = {};
	props.loop = loop;
	props.reversed = reversed;
	cjs.MovieClip.apply(this,[props]);

	// 图层_1
	this.shape = new cjs.Shape();
	this.shape.graphics.f().s("#FF0000").ss(4,1,1).p("AliAPIFnAAIAAFAAAFlOIAAFdIFeAA");
	this.shape.setTransform(-1.5,-2.45);

	this.timeline.addTween(cjs.Tween.get(this.shape).wait(1));

	this._renderFirstFrame();

}).prototype = getMCSymbolPrototype(lib.ptSb, new cjs.Rectangle(-39,-37.9,75,71), null);


(lib.headSb = function(mode,startPosition,loop,reversed) {
if (loop == null) { loop = true; }
if (reversed == null) { reversed = false; }
	var props = new Object();
	props.mode = mode;
	props.startPosition = startPosition;
	props.labels = {};
	props.loop = loop;
	props.reversed = reversed;
	cjs.MovieClip.apply(this,[props]);

	// 图层_1
	this.shape = new cjs.Shape();
	this.shape.graphics.f().s("#006600").ss(4,1,1).p("AISAAQAADcibCbQibCbjcAAQjbAAibibQibibAAjcQAAjbCbibQCbibDbAAQDcAACbCbQCbCbAADbg");
	this.shape.setTransform(0,0.05);

	this.shape_1 = new cjs.Shape();
	this.shape_1.graphics.f("#0000FF").s().p("Al2F3QibicAAjbQAAjaCbicQCcibDaAAQDbAACbCbQCcCcAADaQAADbicCcQibCbjbAAQjaAAicibg");
	this.shape_1.setTransform(0,0.05);

	this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.shape_1},{t:this.shape}]}).wait(1));

	this._renderFirstFrame();

}).prototype = getMCSymbolPrototype(lib.headSb, new cjs.Rectangle(-55,-54.9,110,110), null);


(lib.weaponSb = function(mode,startPosition,loop,reversed) {
if (loop == null) { loop = true; }
if (reversed == null) { reversed = false; }
	var props = new Object();
	props.mode = mode;
	props.startPosition = startPosition;
	props.labels = {};
	props.loop = loop;
	props.reversed = reversed;
	cjs.MovieClip.apply(this,[props]);

	// 图层_1
	this.shape = new cjs.Shape();
	this.shape.graphics.f().s("#006600").ss(4,1,1).p("AFFAAQAADihfCgQhfCfiHAAQiGAAhfifQhfigAAjiQAAjhBfigQBfifCGAAQCHAABfCfQBfCgAADhg");
	this.shape.setTransform(0,29.05);

	this.shape_1 = new cjs.Shape();
	this.shape_1.graphics.f("#0000FF").s().p("AjlGBQhfifAAjiQAAjhBfigQBfifCGAAQCGAABfCfQBgCgAADhQAADihgCfQhfCgiGAAQiGAAhfigg");
	this.shape_1.setTransform(0,29.05);

	this.ptObj = new lib.ptSb();
	this.ptObj.name = "ptObj";
	this.ptObj.setTransform(-1,-59,1,1,0,0,0,-1.5,-2.5);

	this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.ptObj},{t:this.shape_1},{t:this.shape}]}).wait(1));

	this._renderFirstFrame();

}).prototype = getMCSymbolPrototype(lib.weaponSb, new cjs.Rectangle(-38.5,-94.4,75,180), null);


(lib.manSb = function(mode,startPosition,loop,reversed) {
if (loop == null) { loop = true; }
if (reversed == null) { reversed = false; }
	var props = new Object();
	props.mode = mode;
	props.startPosition = startPosition;
	props.labels = {};
	props.loop = loop;
	props.reversed = reversed;
	cjs.MovieClip.apply(this,[props]);

	// 图层_1
	this.instance = new lib.CachedBmp_1();
	this.instance.setTransform(-120,8.05,0.5,0.5);

	this.headObj = new lib.headSb();
	this.headObj.name = "headObj";
	this.headObj.setTransform(-3,-58);

	this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.headObj},{t:this.instance}]}).wait(1));

	this._renderFirstFrame();

}).prototype = getMCSymbolPrototype(lib.manSb, new cjs.Rectangle(-120,-112.9,229,353), null);


// stage content:
(lib.CollideTest = function(mode,startPosition,loop,reversed) {
if (loop == null) { loop = true; }
if (reversed == null) { reversed = false; }
	var props = new Object();
	props.mode = mode;
	props.startPosition = startPosition;
	props.labels = {};
	props.loop = loop;
	props.reversed = reversed;
	cjs.MovieClip.apply(this,[props]);

	this.actionFrames = [0];
	this.isSingleFrame = false;
	// timeline functions:
	this.frame_0 = function() {
		if(this.isSingleFrame) {
			return;
		}
		if(this.totalFrames == 1) {
			this.isSingleFrame = true;
		}
		createjs.Ticker.addEventListener("tick", mousePos);
		this.weaponObj.addEventListener("click", clickPos);
		var _this = this;
		function mousePos() {
			_this.weaponObj.x = stage.mouseX;
			_this.weaponObj.y = stage.mouseY;
			stage.update();
		}
		function clickPos() {
			console.log("x:" + stage.mouseX + " y:" + stage.mouseY + "处已点击");	
			var pt = _this.manObj.headObj.localToLocal(0, 0, _this.weaponObj.ptObj)
			if (_this.manObj.headObj.hitTest(pt.x, pt.y)) {
				console.log("击中");	
		        _this.manObj.headObj.shadow=new createjs.Shadow("#ff0000",5,5,5);	
				_this.manObj.headObj.filters=[new createjs.BlurFilter(10,10,20),new createjs.ColorFilter(1,0,0,0.5,1,0,0,0)];
				_this.manObj.headObj.cache(-100,-100,200,200);	
			} else {
				_this.manObj.headObj.shadow=new createjs.Shadow("#00ffff",0,0,0);	
				_this.manObj.headObj.filters=[];
				_this.manObj.headObj.cache(-100,-100,200,200);	
				console.log("击空");
			}
			stage.update();
			/*_this.weaponObj.rotation-=10
			stage.update();	*/
		}
	}

	// actions tween:
	this.timeline.addTween(cjs.Tween.get(this).call(this.frame_0).wait(1));

	// 图层_1
	this.text = new cjs.Text("碰撞测试说明:\n当红十字对中头部,然后点击,就会爆头;点击其他,头型恢复", "22px 'Microsoft YaHei'", "#0000FF");
	this.text.lineHeight = 31;
	this.text.lineWidth = 561;
	this.text.parent = this;
	this.text.setTransform(24.05,35.2);

	this.weaponObj = new lib.weaponSb();
	this.weaponObj.name = "weaponObj";
	this.weaponObj.setTransform(452,305.5,1,1,0,0,0,-1,-4.5);

	this.manObj = new lib.manSb();
	this.manObj.name = "manObj";
	this.manObj.setTransform(202,330,1,1,0,0,0,-5.5,63.5);

	this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.manObj},{t:this.weaponObj},{t:this.text}]}).wait(1));

	this._renderFirstFrame();

}).prototype = p = new lib.AnMovieClip();
p.nominalBounds = new cjs.Rectangle(322.1,333.2,264.9,173.40000000000003);
// library properties:
lib.properties = {
	id: '59007A9B56A13946B210D55C8906597F',
	width: 600,
	height: 600,
	fps: 24,
	color: "#FFFFFF",
	opacity: 1.00,
	manifest: [
		{src:"images/CollideTest_atlas_1.png", id:"CollideTest_atlas_1"}
	],
	preloads: []
};



// bootstrap callback support:

(lib.Stage = function(canvas) {
	createjs.Stage.call(this, canvas);
}).prototype = p = new createjs.Stage();

p.setAutoPlay = function(autoPlay) {
	this.tickEnabled = autoPlay;
}
p.play = function() { this.tickEnabled = true; this.getChildAt(0).gotoAndPlay(this.getTimelinePosition()) }
p.stop = function(ms) { if(ms) this.seek(ms); this.tickEnabled = false; }
p.seek = function(ms) { this.tickEnabled = true; this.getChildAt(0).gotoAndStop(lib.properties.fps * ms / 1000); }
p.getDuration = function() { return this.getChildAt(0).totalFrames / lib.properties.fps * 1000; }

p.getTimelinePosition = function() { return this.getChildAt(0).currentFrame / lib.properties.fps * 1000; }

an.bootcompsLoaded = an.bootcompsLoaded || [];
if(!an.bootstrapListeners) {
	an.bootstrapListeners=[];
}

an.bootstrapCallback=function(fnCallback) {
	an.bootstrapListeners.push(fnCallback);
	if(an.bootcompsLoaded.length > 0) {
		for(var i=0; i<an.bootcompsLoaded.length; ++i) {
			fnCallback(an.bootcompsLoaded[i]);
		}
	}
};

an.compositions = an.compositions || {};
an.compositions['59007A9B56A13946B210D55C8906597F'] = {
	getStage: function() { return exportRoot.stage; },
	getLibrary: function() { return lib; },
	getSpriteSheet: function() { return ss; },
	getImages: function() { return img; }
};

an.compositionLoaded = function(id) {
	an.bootcompsLoaded.push(id);
	for(var j=0; j<an.bootstrapListeners.length; j++) {
		an.bootstrapListeners[j](id);
	}
}

an.getComposition = function(id) {
	return an.compositions[id];
}


an.makeResponsive = function(isResp, respDim, isScale, scaleType, domContainers) {		
	var lastW, lastH, lastS=1;		
	window.addEventListener('resize', resizeCanvas);		
	resizeCanvas();		
	function resizeCanvas() {			
		var w = lib.properties.width, h = lib.properties.height;			
		var iw = window.innerWidth, ih=window.innerHeight;			
		var pRatio = window.devicePixelRatio || 1, xRatio=iw/w, yRatio=ih/h, sRatio=1;			
		if(isResp) {                
			if((respDim=='width'&&lastW==iw) || (respDim=='height'&&lastH==ih)) {                    
				sRatio = lastS;                
			}				
			else if(!isScale) {					
				if(iw<w || ih<h)						
					sRatio = Math.min(xRatio, yRatio);				
			}				
			else if(scaleType==1) {					
				sRatio = Math.min(xRatio, yRatio);				
			}				
			else if(scaleType==2) {					
				sRatio = Math.max(xRatio, yRatio);				
			}			
		}
		domContainers[0].width = w * pRatio * sRatio;			
		domContainers[0].height = h * pRatio * sRatio;
		domContainers.forEach(function(container) {				
			container.style.width = w * sRatio + 'px';				
			container.style.height = h * sRatio + 'px';			
		});
		stage.scaleX = pRatio*sRatio;			
		stage.scaleY = pRatio*sRatio;
		lastW = iw; lastH = ih; lastS = sRatio;            
		stage.tickOnUpdate = false;            
		stage.update();            
		stage.tickOnUpdate = true;		
	}
}
an.handleSoundStreamOnTick = function(event) {
	if(!event.paused){
		var stageChild = stage.getChildAt(0);
		if(!stageChild.paused || stageChild.ignorePause){
			stageChild.syncStreamSounds();
		}
	}
}
an.handleFilterCache = function(event) {
	if(!event.paused){
		var target = event.target;
		if(target){
			if(target.filterCacheList){
				for(var index = 0; index < target.filterCacheList.length ; index++){
					var cacheInst = target.filterCacheList[index];
					if((cacheInst.startFrame <= target.currentFrame) && (target.currentFrame <= cacheInst.endFrame)){
						cacheInst.instance.cache(cacheInst.x, cacheInst.y, cacheInst.w, cacheInst.h);
					}
				}
			}
		}
	}
}


})(createjs = createjs||{}, AdobeAn = AdobeAn||{});
var createjs, AdobeAn;